<!--
/**************************************************
* @ balanceddetail.jsp
*
* Copyright   2006 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/05/12, Jenny Li
*  1) first release
/**************************************************
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<html>
<head>
<title>对帐明细</title>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css"" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/calendar.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<%

	ResultProcess tOrder = (ResultProcess)request.getAttribute("orderdetail");
	String isRequery  = (String)request.getAttribute("requery");
	ArrayList tList = new ArrayList();
	String d1=(String)request.getAttribute("ordersum");
    DecimalFormat df=new DecimalFormat("0.0000");
    double dou1=0;
    double dou2=0;
    if(d1!=null){
        dou1=Double.parseDouble(d1);
    }
    String d2=(String)request.getAttribute("stockssum");
    if(d2!=null){
        dou2=Double.parseDouble(d2);
    }
%>
<script>
     function  findstocks(a,b){
        var url = "<%=response.encodeURL(root + "/A181406.do")%>?deptId="+a+"&balanceYM="+b;
        window.open(url,"newwindow",'height=600,width=900,top=0,left=100,toolbar=no,menubar=no,scrollbars=yes,resizable=no, location=no,status=no');
     }
	function process(val){
		var category = "<%=request.getAttribute("deptCategory")%>";		
		if(val == 'E'){
			balancedetailform.action = "<%=response.encodeURL(root + "/A180215.do")%>";
    		balancedetailform.submit();
		}else if(val == 'CW'){
			window.opener.location.href = window.opener.location.href;
			//window.opener.location.reload();
			window.close();
		}	
	}
	function control(val){
		if(val == 'requery'){
			<%
				if(isRequery != null && isRequery.equals("true")){
			%>
			balancedetailform.action = "<%=response.encodeURL(root + "/A180212.do")%>";
    		balancedetailform.submit();		
			<%		
				}
			%>
		}
	}	
		</script>
	</head>
	<body BGCOLOR="#f2f2f2" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="control('requery')">
		<form name="balancedetailform" method="get">
		<input type="hidden" name="deptId" value="<%=request.getAttribute("deptId") %>">
		<input type="hidden" name="balanceYM" value="<%=request.getAttribute("balanceYM") %>">
		<input type="hidden" name="deptCategory" value="<%=request.getAttribute("deptCategory") %>">	
        <%if(tOrder != null){
            int totalRecords = 0;
            if(request.getAttribute("totalRecords")!=null){
                totalRecords=Integer.parseInt((String)request.getAttribute("totalRecords"));
            }
            int defaultPageSize =10;
            if(request.getAttribute("pageSize")!=null){
                defaultPageSize=Integer.parseInt((String)request.getAttribute("pageSize"));
            }
            %>          
            <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'></page:pager>
            <%} %>	
		</form>
			<p><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><br>
			</p>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td height="20">
						<table width="100%" border="0" cellspacing="0" cellpadding="1">
							<tr height="20">
								<td height="30" width="758" class="mtxt_black">
								对帐明细
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td class="bg_line" height="2"></td>
				</tr>
			</table>
			<br>
		<center>
		<%
			if(tOrder != null){
		%>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td>
            <form name='pager' method="post">
						<input type="hidden" name="action" value='<%=response.encodeURL(root + "/A180209.do")%>'>			               				
						
							<table class="bg_table" id="tableId" cellspacing="1" cellpadding="2" width="100%" align="center"
								border="0">
								<input type="hidden" name="deptId1">
								<input type="hidden" name="balanceYM1">								
								<input type="hidden" name="deptCategory1">			
								<tbody>
									<tr class="bg_column" height="20">
                                        <%
                                        if(dou2<=0){
                                        %>
                                        <td class="top" align="left" colspan="17">
                                            <b>压库领用明细</b>&nbsp;&nbsp;&nbsp;<font color="red">该对账记录不包含压库领用明细</font>
                                        </td>
                                        <%}else{ %>
                                        <td class="top" align="left" colspan="17">
                                             <b>压库领用明细</b>&nbsp;&nbsp;&nbsp;压库应付金额(元)：<%=df.format(dou2) %>&nbsp;&nbsp;&nbsp;&nbsp;
                                             <a href="javascript:void(0);" onclick="findstocks('<%=request.getAttribute("deptId") %>','<%=request.getAttribute("balanceYM")%>');">查看明细</a>
                                        </td>                                        
                                        <%} %>
                                    </tr>
                                    <tr class="bg_column" height="20">
                                        <td class="top" align="left" colspan="18">
                                            <b>订单信息列表</b>&nbsp;&nbsp;&nbsp;订单应付金额(元)：<%=df.format(dou1) %>
                                        </td>
                                    </tr>
									<%
										//tList = tOrder.getDisplayRecords(index.intValue(),pageSize.intValue());
										tList = tOrder.getAllRecoreds();
									%>


									<tr class="bg_column" height="20">
										<td class="top" align="center">
											<div align="center" class="txt_content">送货单号</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">订货单位</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">供应商</div>
										</td>										
										<td class="top" align="center">
											<div align="center" class="txt_content">集中编码</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">产品名称</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">是否交易平台产品</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">规格</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">型号</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">品牌</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">生产厂商</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">签收数量</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">签收价格<br>
												（元）</div>
										</td>
                                        <td class="top" align="center">
                                            <div align="center" class="txt_content">合计<br>
                                                （元）</div>
                                        </td>
										<td class="top" align="center">
											<div align="center" class="txt_content">签收日期<br>
												</div>
										</td>										
										<td class="top" align="center">
											<div align="center" class="txt_content">详细</div>
										</td>
									</tr>
									<%
									//tList = tOrder.getDisplayRecords(index.intValue(),pageSize.intValue());
										if(tList != null && tList.size() > 0){
										    for(int i=0; i<tList.size(); i++){
										        String[] tStr = (String[])tList.get(i);
												String tTempStr="";
												if(i%2==0){
													tTempStr="bg_row_odd";
												}else {
													tTempStr="bg_row_even";
												}										        
									%>
									<tr class="<%=tTempStr%>" height="20">
											<input type="hidden" name="orderDetailIds" value="<%=tStr[1]%>">									
											<input type="hidden" name="orderIds" value="<%=tStr[0]%>">																				
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[2] %></div><!-- 出货单号-->
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[3] %></div><!-- 订货单位 -->
										</td>
										<td class="top" align="center">
										<%
										String temp = "";
										if(tStr[8].equals("0")&& tStr[9].equals("0")){
											temp = "(采购网配送)";
										}											
										%>
											<div align="center" class="txt_content"><a href="<%=response.encodeURL(root + "/A400108.do?providerId=" + tStr[4]) %>" target="_blank"><%=tStr[5] %></a><%=temp%></div><!-- 供应商 -->
										</td>										
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[6] %></div><!-- 集中编码 -->
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">
											<A href="<%=response.encodeURL(root + "/A150103.do?&concentricityId=" + tStr[6])%>" target="_blank"><%=tStr[7]%></A><!-- 产品名称 -->
											</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=GSBaseManager.getIsTradeManuf(tStr[8])%></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[10]%></div><!-- 规格 -->
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[11]%></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content"><%=tStr[12]%></div>
										</td>
										<td class="top" align="center">

											<div align="center" class="txt_content"><%=tStr[13]%></div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">
												<%=tStr[17] %>
											</div>
										</td>
										<td class="top" align="center">
											<div align="center" class="txt_content">
												<%=tStr[18] %>
											</div>
										</td>
                                        <td class="top" align="center">
                                            <div align="center" class="txt_content">
                                                <%=df.format(Double.parseDouble(tStr[18])*Double.parseDouble(tStr[17])) %>
                                            </div>
                                        </td>
										<td class="top" align="center">
											<div align="center" class="txt_content">
												<%=tStr[19] %>
											</div>
										</td>										
										<td class="top" align="center">
											<div align="center" class="txt_content">
											<a href="<%=response.encodeURL(root+"/A150505.do")%>?orderId=<%=tStr[0]%>&orderDetailId=<%=tStr[1]%>" target="_blank">详细</A></div>
										</td>
									</tr>
									<%
										    }
									%>
									<tr class="bg_column" height="20">
								    <td width="960" height="16" colspan="17" align="right">
											<!--导航条-->
								    		<page:navigator type='text' queryForm="balancedetailform"/>
								    </td>
								    </tr>
							    <%
									}else{
								%>
										<font color="red">没有符合条件的订单信息</font>
								<%
									}
								%>
								    
								</tbody>
							</table>
				</form>							
					</td>
				</tr>
			</table>
		</center>
			<p align="center">
				<tr>
					<td align="center">
						<INPUT type="button" value="导出至Excel" class="kuang" onClick="process('E')">	
						<INPUT type="button" value="关闭" class="kuang" onClick="process('CW')">													
						<br>
					</td>
				</tr>
				</p>			
			<%
				}
				if(tOrder == null && isRequery != null && isRequery.equals("true")){
		    %>
		    	<font size="2">数据查询中......</font>
		    <%
				}
		    %>					    		
	</body>
</html>